// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

unsigned int prev_seconds=0;

void setup () {
    Serial.begin(57600);
    Wire.begin();
    RTC.begin();

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
    // following line sets the RTC to the date & time this sketch was compiled
    //RTC.adjust(DateTime(__DATE__, __TIME__));  
  }
}

void loop () 
{
    DateTime now = RTC.now();
    
    unsigned int curr_seconds = now.second();
    if(curr_seconds!= prev_seconds)
    {
      Serial.println(now.second(), DEC);
      prev_seconds = curr_seconds;
    }
    delay(100);
}
